'''
Author: your name
Date: 2021-04-06 17:39:35
LastEditTime: 2021-04-07 10:08:44
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: /tinyms/tinyms-api/apps/auth/role/rolemenuservice.py
'''
import json
from app import db
from .rolemenu import RoleMenu

class RoleMenuService():
        #根据角色主键批量删除数据
    def delete(fk_roles_pk):
        rolemenu = RoleMenu.query.filter(RoleMenu.fk_roles_pk==fk_roles_pk).delete()
        # db.session.delete(rolemenu)
        db.session.commit()#必须要有db.session.commit,否则数据无法删除

    #保存角色与权限的对应关系
    def save(RoleMenu):
        db.session.add(RoleMenu)
        db.session.commit()